package com.xcdh.trading.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xcdh.trading.entity.StockInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface StockInfoMapper extends BaseMapper<StockInfo> {

    @Select("SELECT MAX(trade_date) FROM stock_info")
    String selectMaxTradeDate();

    @Select("SELECT trade_date FROM stock_info GROUP BY trade_date order by trade_date  desc limit 3")
    List<String> selectMaxTradeDateTop3();

    IPage<StockInfo> listByPage(@Param("page") IPage<StockInfo> page, @Param("ew") QueryWrapper<StockInfo> queryWrapper);
}
